import React from "react";
import { Switch, Tooltip } from "antd";
import { BulbOutlined } from "@ant-design/icons";

const ThemeSwitcher: React.FC<{
  value: string;
  onChange: (v: string) => void;
}> = ({ value, onChange }) => (
  <Tooltip title={value === "dark" ? "切换为明亮主题" : "切换为暗黑主题"}>
    <Switch
      checked={value === "dark"}
      checkedChildren={<BulbOutlined />}
      unCheckedChildren={<BulbOutlined />}
      onChange={(checked) => onChange(checked ? "dark" : "light")}
      style={{ marginRight: 16 }}
    />
  </Tooltip>
);

export default ThemeSwitcher;
